var ifOk = true;
	$(function(){
		$("#code").blur(function(){
			if($("#code").val().length == 0 ){
				$("#code").css({
					"border":"1px solid rgb(255,128,128)"
				});
				ifOk = false;
			}
			checkCode();
		});
		$("#code").focus(function(){
			$("#code").attr("placeholder","点击图片更换");
			$("#code").css({
				"border":"none"
			});
			ifOk = true;
		});
		
	});
	
	function myReload() {  
	    document.getElementById("verifyCode").src = document  
	            .getElementById("verifyCode").src  
	            + "&nocache=" + new Date().getTime();  
	} 

	

	//创建XMLHttpRequest对象
		function createXMLHttpRequest(){
			var xmlhttp;
			if (window.XMLHttpRequest)
			  {// code for IE7+, Firefox, Chrome, Opera, Safari
			  	xmlhttp=new XMLHttpRequest();
			  }
			else
			  {// code for IE6, IE5
			  	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
			return xmlhttp;
		}
		
		function checkCode(){	
			var xmlHttpRequest = createXMLHttpRequest();
			//服务器路径
			var surl = "verify.do?type=2";
			//使用open()和send()方法把请求发送到服务器
			xmlHttpRequest.open("Get",surl,true);
			xmlHttpRequest.send();
			//根据readyState的值确定数据是否传回浏览器
			xmlHttpRequest.onreadystatechange=function(){
				if(xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200){
					if(xmlHttpRequest.responseText != $("#code").val()){
						$("#code").val("");
						$("#code").attr("placeholder","验证码错误！");
						$("#code").css({
							"border":"1px solid rgb(255,128,128)"
						});
						myReload();
					}
				}
			}
		}